#ifndef __TCPSERVER_HPP__
#define __TCPSERVER_HPP__

#include "Accpetor.hpp"
#include "EventLoop.hpp"

namespace wd{

class TcpServer{
public:
    TcpServer(int port ,string ip)
    :_acceptor(port,ip)
    ,_eventloop(_acceptor){


    }

    void start(){
        _acceptor.ready();
        _eventloop.loop();
    }

    void stop(){
        _eventloop.unloop();
    }

    void setAllCallbacks(Callback && cb1,Callback && cb2, Callback && cb3){
        _eventloop.setAllCallbacks(std::move(cb1)
                                   ,std::move(cb2)
                                   ,std::move(cb3));

    }

private:
    Acceptor _acceptor;
    EventLoop _eventloop;

};

}

#endif // __TCPSERVER_HPP__

